/// <reference path="references.scss" />

$section-header-height: 70px;

:root {
    --content-padding-x: #{$content-padding-x / 2};
    --content-padding-y: #{$content-padding-y};
    // Adjust to medium button height
    --section-header-size: calc((#{$input-btn-font-size} * #{$input-btn-line-height}) + #{$input-padding-y * 2} + 2px);

    @include media-breakpoint-up(lg) {
        --content-padding-x: #{$content-padding-x};
    }
}

//
// Legacy BS elements
// --------------------------------------------------

.well {
    background-color: $gray-100;
    padding: 1rem;
    margin-bottom: $alert-margin-bottom;
    border-radius: var(--border-radius-md);
}

pre {
    background: $gray-100;
    padding: 1rem;
    border: 1px solid rgba(#000, 0.1);

    &.prettyprint {
        padding: 1rem !important;
        border: 1px solid rgba(#000, 0.1) !important;
    }
}


// Typo
// -----------------------------------------------------

b, strong {
    font-weight: $font-weight-medium;
}

.text-light {
    color: $gray-400 !important;
}

.text-primary-darkest {
    color: $sm-violet !important;
}


// Badges (lighter with shadow ring)
// -----------------------------------------------------

.badge-secondary {
    --badge-bg: #{$gray-600};
    --badge-bg-rgb: #{to-rgb($gray-600)};
    --badge-color: #{$yiq-text-light};

    @at-root a#{&} {
        --badge-hover-bg: #{$gray-700};
        --badge-hover-bg-rgb: #{to-rgb($gray-700)};
    }
}


//
// Buttons
// -----------------------------------------------------

// Light button icons lighter (looks nice).
.btn-secondary:not(.btn-flat-light),
.btn-light:not(.btn-flat-light) {
    --btn-icon-color: #{lighten($body-color, 16%)};
    --btn-icon-hover-color: inherit;
}


//
// Layout
// -----------------------------------------------------

html {
    height: 100%;
}

body {
    background-color: $gray-150;

    &.popup {
        background-color: #fff;
    }

    &.popup .dispensable {
        display: none !important;
    }
}

#page {
    position: relative;
    margin: 0;
    padding: 0;
}

.page-main {
    --sticky-header-left: 0;
    --sticky-header-right: 0;
    --header-height: 72px;
    --device-height: 100vh; // for clients that do not support dvh
    --device-height: 100dvh;
    --content-top: calc(72px + var(--header-height));
    --content-height: calc(var(--device-height) - var(--content-top) - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    --content-row: minmax(var(--content-height), auto);
    position: relative;
    display: grid;
    grid-template-columns: 100%;
    grid-template-rows: 72px var(--header-height) var(--content-row);

    @include media-breakpoint-up(sm) {
        --sticky-header-left: var(--content-padding-x);
        --sticky-header-right: var(--content-padding-x);
    }
}

#header {
    @include gradient-bg($indigo);
    grid-column: 1 / -1;
    grid-row: 1 / span 2;
}

.sidebar-left {
    grid-column: 1 / 2;
}

.popup {
    // Larger padding-x in popups
    --content-padding-x: #{$content-padding-x};
}

#content {
    position: relative;
    margin: 0;
    padding-left: var(--content-padding-x);
    padding-right: var(--content-padding-x);
    padding-top: $section-header-height;
    padding-bottom: var(--content-padding-x);
    box-shadow: $box-shadow-sm;
    border-radius: 0;
    background-color: #fff;
    grid-column: 1 / -1;
    grid-row: 2 / -1;
    z-index: 9;
    //overflow-x: hidden; // observe and maybe uncomment later

    @include media-breakpoint-up(sm) {
        margin: 0 var(--content-padding-x);
        border-radius: 0.75rem 0.75rem 0 0;
    }

    .popup & {
        margin: 0;
        border: 0;
        box-shadow: none;
        border-radius: 0;
        grid-row: 1 / -1;
    }
}

.cph {
    display: flex;
    flex-flow: column;
}

.popup.bare {
    height: 100%;
    //overflow-y: hidden;
    overflow-y: auto;
    overflow-x: hidden;

    #page,
    #content,
    .cph {
        height: 100%;
        padding: 0;
    }
}

.section-header {
    position: absolute;
    inset-inline-start: 0;
    inset-inline-end: 0;
    top: 0;
    padding-inline: var(--content-padding-x);
    padding-block: var(--content-padding-y);
    transition: box-shadow 0.25s ease;

    @include make-row();
    flex-wrap: nowrap;
    margin-inline: 0;

    .title, .options {
        @include make-col-ready();
    }

    .title {
        font-family: $headings-font-family;
        font-weight: $font-weight-medium;
        color: $headings-color;
        font-size: $h4-font-size;
        line-height: var(--section-header-size);
        min-height: var(--section-header-size);
        vertical-align: middle;
        @include text-truncate();
        padding-inline: 0 5px;
        color: inherit;
        display: inline-flex;
        align-items: center;
        gap: 0.75rem;
        // mimic .col
        flex-basis: 0;
        flex-grow: 1;
        max-width: 100%;

        > i {
            display: none; // Turn off for now, seems to look nicer
            font-size: 28px;
            vertical-align: text-top;
            margin-inline-end: 0.5rem;
            color: $text-muted;
        }

        > img {
            max-height: var(--section-header-size);
            max-width: 120px;
            vertical-align: top;
        }

        a:not(.btn):not(.dropdown-item) {
            text-decoration: none;
            font-family: $font-family-sans-serif;
            font-size: 12px;
            font-weight: normal;
            padding-inline-start: 5px;
        }
    }
    // .title
    .options {
        // mimic .col-auto
        flex: 0 0 auto;
        width: auto;
        max-width: none; // Reset earlier grid tiers
        padding-inline: 5px 0;
        display: flex;
        align-items: center;
        gap: 0.4rem;

        &.btn-toolbar {
            margin: 0;
        }

        @media (max-width: 768px) {
            // hide action button labels on small screens
            .btn > span:not(:only-child) {
                display: none;
            }
        }
    }

    &.sticky {
        position: fixed;
        z-index: $zindex-sticky;
        inset-inline-start: var(--sticky-header-left);
        inset-inline-end: var(--sticky-header-right);
        padding: calc(var(--content-padding-y) / 2) var(--content-padding-x);
        background: #fff;
        box-shadow: 0 10px 30px 0 rgba($black, .05);

        .modal-open & {
            // add the killed scrollbar width
            margin-inline-end: 17px !important;
        }
    }
}

.popup .section-header.sticky {
    left: 0;
    right: 0;
    top: 0;
}

@include media-breakpoint-up(md) {
    .has-left-sidebar {
        .page-main {
            grid-template-columns: 206px 1fr;
            --sticky-header-left: 206px;
            --sticky-header-right: 0;
        }

        #content {
            grid-column: 2 / -1;
            margin-inline: 0;
            border-start-end-radius: 0;
        }

        .locale-editor {
            max-width: calc(100dvw - var(--sticky-header-left) - (var(--content-padding-x) * 2));
        }
    }
}

.spa-layout {
    height: 100%;
    overflow: hidden;

    #page {
        height: 100%;
    }

    .page-main {
        height: 100%;
        grid-template-columns: 1fr minmax(380px, 20%);
        --content-row: var(--content-height);
    }

    .cph {
        height: 100%;
    }

    .spa-stretch {
        overflow: hidden;
        display: flex;
        flex-flow: column;
    }
}

@include media-breakpoint-up(md) {
    .spa-layout.has-left-sidebar .page-main {
        grid-template-columns: 206px minmax(100px, 1fr) !important;
    }
}

//
// Minimal admin layout
// --------------------------------------------------------------

.minimal-admin {
    #content {
        background-color: transparent;
        box-shadow: none;
        margin: 0;
        padding-top: 0;

        .section-header {
            display: none;
        }
    }
}


//
// Main Menu
// --------------------------------------------------------------

#navbar {
    padding: 0 var(--content-padding-x);

    .dropdown-toggle:after {
        display: none;
    }

    .navbar-brand > .navbar-img {
        // Edge cannot auto-scale SVGs. We need to provide both width and height.
        height: 28px;
        width: 33px;

        @include media-breakpoint-up(lg) {
            height: 28px;
            width: 160px;
        }
    }

    .dropdown-menu {
      --dropdown-padding-x: 0.5rem;
      --dropdown-padding-y: 0.5rem;
      --dropdown-item-padding-x: 1rem;
      --dropdown-item-padding-y: 0.5rem;
      --dropdown-divider-margin-y: 0.5rem;
      --dropdown-border-radius: 8px;
      --shadow-intensity: 0.7;
      --dropdown-box-shadow: #{$box-shadow-lg};
        margin-top: -2px;
    }

    #navbar-menu .nav-item > .dropdown-menu {
        @include bubble("top", "near", 8, var(--dropdown-bg), var(--dropdown-border-color), 10px);
    }

    [data-id="nav-modules"] li:not([data-id="modules-manage"]) .dropdown-item {
        // Don't emphasize plugin entries
        font-weight: $font-weight-normal;
    }

    .dropdown-item {
        font-weight: $font-weight-medium;
        gap: 1rem;
    }

    .dropdown-header {
        font-size: $font-size-xs;
        text-transform: uppercase;
    }

    .dropdown-divider {
        margin-block: 0.5rem;
    }

    .nav-item {
        .nav-link {
            max-width: 100px;
            padding: 14px 8px !important;
            text-align: center;
            color: #fff;
            background: rgba(#fff, 0);
            transition: color 0.1s linear, opacity 0.1s linear, background-color 0.1s linear;
            color: mix($indigo, #fff, 22%);
        }

        .nav-link:hover,
        &.show .nav-link {
            background: rgba(#fff, .15);
            color: #fff;
        }

        .navbar-icon {
            position: relative;
            text-align: center;
            vertical-align: middle;
            font-size: 20px;
            height: 22px;
            line-height: 22px;

            @include media-breakpoint-only(xs) {
                font-size: 16px;
            }
        }

        .navbar-label {
            @include text-truncate();
            text-align: center;
            font-size: 12px;
            padding: 0;
            padding-top: 0.25rem;
        }

        .navbar-tool {
            padding-left: 0.625rem !important;
            padding-right: 0.625rem !important;
            height: 72px;
            display: flex;

            > * {
                align-self: center;
            }
        }
    }

    .reddot {
        position: absolute;
        width: 10px;
        height: 10px;
        border-radius: 50%;
        background-color: $red;
        color: #fff;
    }
}


//
// Settings Menu
// --------------------------------------------------------------

.settings-menu {
    --list-group-bg: transparent;
    --list-group-border-width: 0;
    --list-group-border-radius: 0;
    --list-group-item-padding-x: 12px;
    --list-group-item-padding-y: 10px;
    --list-group-action-color: var(--gray-700);
    --list-group-action-hover-color: var(--gray-900);
    --list-group-action-hover-bg: #{rgba($black, 0.06)};
    --list-group-action-hover-bg: var(--gray-300);
    --list-group-action-active-color: var(--list-group-action-hover-color);
    --list-group-action-active-bg: var(--gray-400);
    --list-group-active-bg: var(--list-group-action-hover-bg);

    gap: 1px;

    .list-group-item {
        @include rfs($font-size-sm);
        align-items: center !important;
        transition: background-color 0.12s ease;

        @include media-breakpoint-up(md) {
            @include border-right-radius(#{'0 !important'});
        }

        &:before {
            display: none !important;
        }

        > .list-group-item-icon {
            margin-inline-end: 1rem;

             > .bi {
                vertical-align: -3px;
            }

            > i {
                max-width: 16px;
            }
        }

        &:active:not(.active) {
            .bi-circle {
                fill: transparent;
            }
        }
    }
}


//
// Forms
// --------------------------------------------------

legend {
    font-family: $headings-font-family;
    font-weight: $headings-font-weight;
    font-size: 1.25rem;
}

.col-form-label {
    font-weight: $font-weight-medium;
}

.ctl-label {
    position: relative;
    padding-right: 2.5rem;
    display: inline-block;

    > label {
        position: relative;
        padding-right: 0;
        margin-bottom: 0.4rem;
        font-weight: $font-weight-medium;
    }

    > .hint {
        $hintColor: $gray-600;
        display: block;
        position: absolute;
        cursor: default;
        width: 2.5rem;
        right: 0;
        top: 0;
        text-decoration: none;
        outline: 0;
        color: $hintColor;
        transition: all .1s ease-in-out;
        opacity: 0;
        text-align: center;

        &:hover {
            color: $gray-700;
        }

        > i {
            font-size: 1rem;
        }
    }

    &:hover > .hint {
        opacity: 1;
    }

    .col-form-label-sm + .hint {
        width: 1rem;
        margin-bottom: 0;
        line-height: $input-line-height-sm;
        padding-top: calc(#{$input-padding-y-sm} + #{$input-border-width});
        padding-bottom: calc(#{$input-padding-y-sm} + #{$input-border-width});

        > i {
            font-size: inherit;
        }
    }
}


//
// Multi-store settings
// --------------------------------------------------

.multi-store-setting-control > input[type=checkbox] {
    position: relative;
    margin: 0;
    margin-top: $input-padding-y;
}


//
// AJAX Busy
// --------------------------------------------------

@keyframes loading {
    from {
        left: 50%;
        width: 0;
        z-index: 100;
    }

    50% {
        left: 0;
        width: 100%;
        z-index: 10;
    }

    to {
        left: 0;
        width: 100%;
    }
}

@keyframes loadingbar {
    from {
        left: -200px;
        width: 30%;
    }

    50% {
        width: 30%;
    }

    70% {
        width: 70%;
    }

    80% {
        left: 50%;
    }

    95% {
        left: 120%;
    }

    to {
        left: 100%;
    }
}

#ajax-busy {
    position: fixed;
    opacity: 0;
    left: 0;
    right: 0;
    top: 0;
    height: 3px;
    z-index: $zindex-sticky + 1;
    background-color: #ffab40;
    transition: opacity .05s ease-in;

    .sticky-header & {
        left: var(--content-padding-x);
        right: var(--content-padding-x);
    }

    body.note-fullscreen-body & {
        z-index: $zindex-tooltip + 10;
    }

    &.busy {
        opacity: 1;
    }

    &.busy > .bar {
        content: "";
        display: inline;
        position: absolute;
        width: 0;
        height: 100%;
        left: 50%;
        text-align: center;
        animation: loading 1.5s $ease-in-out-quad infinite;
    }

    > .bar:nth-child(1) {
        background-color: #fff;
    }

    > .bar:nth-child(2) {
        background-color: #3F51B5;
        animation-delay: 0.5s;
    }

    > .bar:nth-child(3) {
        background-color: #ffab40;
        animation-delay: 1s;
    }
}

.loading-bar {
    height: 4px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #ddd;

    &:before {
        display: block;
        position: absolute;
        content: "";
        left: -200px;
        width: 200px;
        height: 4px;
        background-color: #2980b9;
        animation: loadingbar 2s linear infinite;
    }
}


//
// Apply grid layout to editor tables (.adminContent)
// --------------------------------------------------

.adminData {
    select,
    input,
    textarea,
    .uneditable-input,
    .input-append,
    .input-prepend {
        margin-bottom: 0 !important;
    }
}

.adminContent {
    --adminRow-margin-y: 0.8rem;

    display: block;
    width: 100%;
    margin-right: auto;
    margin-left: auto;
    padding-left: 0;
    padding-right: 0;
    border-collapse: initial;

    > tbody {
        display: flex;
        flex-flow: column;
        border-collapse: initial;
    }

    > tbody > tr,
    > tr,
    .adminRow {
        display: flex;
        flex-wrap: wrap;
        margin-top: 0.4rem;
        margin-bottom: 0.4rem;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    div.adminRow {
        // div type rows do margin collapse, fix it.
        margin-block: var(--adminRow-margin-y, 0.8rem);
    }

    .adminTitle,
    .adminData {
        position: relative;
        @include make-col-ready();
        padding-right: 0;
        padding-left: 0;
        display: block;
    }

    .adminTitle {
        margin-bottom: 0;
    }

    > tbody > tr > td:only-child:not(.adminData):not(.adminTitle),
    > tr > td:only-child:not(.adminData):not(.adminTitle) {
        flex-grow: 1;
        max-width: 100%;
    }

    &:not(.adminContent-vertical) > tbody > tr:not(.wide),
    &:not(.adminContent-vertical) > tr:not(.wide),
    &:not(.adminContent-vertical) .adminRow:not(.wide) {
        @include media-breakpoint-up(md) {
            flex-wrap: nowrap;

            > .adminTitle {
                flex: 0 0 33.333333%;
                max-width: 33.333333%;
                //text-align: right;
                padding-right: 0 !important;

                .ctl-label > label,
                .ctl-label > .hint {
                    // actually is '.col-form-label', @extend is not possible here.
                    font-size: inherit;
                    line-height: $input-line-height;
                    padding-top: calc(#{$input-padding-y} + #{$input-border-width});
                    padding-bottom: calc(#{$input-padding-y} + #{$input-border-width});
                    margin-bottom: 0;
                }
            }

            > .adminData {
                flex: 0 0 66.666667%;
                max-width: 66.666667%;
                padding-left: 0 !important;

                &:not(.wide) {
                    padding-right: 0 !important;
                }
            }
        }

        @include media-breakpoint-up(lg) {
            > .adminTitle {
                flex-basis: calc(400px - var(--adminContent-padding, 0px));
                max-width: 40%;
            }

            > .adminData {
                flex-basis: 600px;
                width: 600px;
                max-width: 60%;

                &.wide {
                    flex-grow: 1;
                    flex-basis: 0;
                    max-width: 100%;
                }
            }
        }
    }

    &.adminContent-boxed {
        --adminContent-padding: 1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

.adminData .adminRow:first-child,
.collapsible > .adminRow:first-child {
    margin-top: 0;
}

.adminSeparator {
    width: 100%;
}

//
// Tables
// --------------------------------------------------

.admin-table {
    $tbcolor: darken($table-border-color, 5%);
    border: 1px solid $tbcolor;

    .table-toolbar {
        caption-side: top;
        padding: 0.375rem;
        background-color: $table-head-bg;
        border: 1px solid $tbcolor;
        border-bottom: 0;
    }

    thead {
        background-color: $table-head-bg;
    }

    thead th {
        line-height: 1.75rem;
        border-bottom-width: 1px;
        border-top-color: $tbcolor;
    }

    td, th {
        vertical-align: middle;
    }

    .disabled {
        color: $text-muted;
    }

    .progress-info {
        min-width: 260px;
    }

    select, input {
        margin-bottom: 0;
    }
}

// Handle action button toggling in tables & grids

.admin-table tbody {
    .omega {
        text-align: end;
    }

    tr {
        > .omega .btn {
            visibility: hidden;
        }

        &:hover > .omega .btn {
            visibility: visible;
        }
    }
}

//
// Locale Editor
// --------------------------------------------------

.locale-editor {
    $border-color: $card-border-color;

    background-color: #fff;
    border: 1px solid $border-color;
    margin-bottom: 1rem;
    border-radius: var(--border-radius-md);

    --tab-caption-display-xs: none;
    --tab-caption-display-sm: var(--tab-caption-display-xs);
    --tab-caption-display-md: var(--tab-caption-display-sm);
    --tab-caption-display-lg: var(--tab-caption-display-md);
    --tab-caption-display-xl: var(--tab-caption-display-lg);

    .nav-locales > .nav {
        --nav-link-font-weight: #{$font-weight-normal};
        --nav-link-color: #{tint-color($gray-700, 8%)};

        gap: 4px 2px;
        padding: 0.4rem;
        border-bottom: 1px solid $border-color;
        background-color: $gray-100;
        @include border-top-radius(var(--border-radius-md));
        flex-wrap: nowrap;
        overflow-x: hidden;

        .nav-item {
            position: relative;
        }

        .nav-icon {
            font-size: 1rem;
        }

        .nav-link {
            --nav-link-hover-color: var(--btn-hover-color);
            --nav-tabs-link-hover-border-color: var(--btn-hover-border-color);
            --nav-tabs-link-active-color: var(--btn-active-color);
            --nav-tabs-link-active-bg: var(--btn-active-bg);
            --nav-tabs-link-active-border-color: var(--btn-active-border-color);
            --btn-box-shadow: none;

            margin-bottom: 0;
            padding: 0.4rem 0.75rem;
            height: auto;
            border-radius: var(--nav-tabs-border-radius);

            &:active {
                border-color: var(--nav-tabs-link-active-border-color);
            } 
        }

        .nav-item-master {
            padding-right: 6px;

            // The separator
            > .nav-link:after {
                position: absolute;
                content: "";
                display: block;
                width: 1px;
                height: 100%;
                right: 2px;
                background-color: $border-color;
            }
        }

        .nav-item-locale {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
            flex-shrink: 1;
            min-width: 38px;
            max-width: 170px;

            .tab-caption {
                display: var(--tab-caption-display-xs);
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;

                @include media-breakpoint-up(sm) {
                    display: var(--tab-caption-display-sm);
                }

                @include media-breakpoint-up(md) {
                    display: var(--tab-caption-display-md);
                }

                @include media-breakpoint-up(lg) {
                    display: var(--tab-caption-display-lg);
                }

                @include media-breakpoint-up(xl) {
                    display: var(--tab-caption-display-xl);
                }
            }
        }

        .nav-link {
            > img { opacity: 0.8; }

            &:hover,
            &.active {
                color: inherit;
                > img { opacity: 1; }
            }
        }
    }
}

.locale-editor-content {
    --adminContent-padding: 1rem;
    padding-left: 1rem;
    padding-right: 1rem;
}

.locale-editor-content[data-rtl="true"] {
    input,
    textarea,
    select,
    .locale-editor-control,
    .note-editable,
    .note-editor-preview:not(.empty) {
        direction: rtl;
        text-align: right;
    }
}


//
// Thumb Zoomer
// --------------------------------------------------

.zoomable-thumb-container {
    width: 50px;
    height: 32px;
    line-height: 32px;
    display: inline-block;
    text-align: center;
    vertical-align: middle;

    > img {
        max-height: 100%;
        max-width: 100%;
    }
}

.zoomable-thumb {
    max-width: 50px;
    max-height: 32px;
}

.zoomable-thumb-clone {
    border: 1px solid #bbb;
    background-color: #fff;
    z-index: 100;
}


// Reset BS' check/radio positioning in adminData-columns
.adminData > .form-check-input {
    position: relative;
    margin-left: 0;
}


//
// admin-config-group
// --------------------------------------------------

.admin-config-group {
    display: block;
    width: 100%;
    text-decoration: none;
    color: inherit;

    &:hover {
        text-decoration: none;
        color: inherit;
    }

    .title,
    .small-title,
    .head {
        font-family: $headings-font-family;
        font-weight: $headings-font-weight;
        color: $gray-600;
        border-bottom: 1px solid rgba(#000, 0.11);
    }

    .sub-title {
        font-family: $font-family-base;
        font-size: $font-size-base;
        font-weight: 100;
    }

    .title,
    .head {
        font-size: $h5-font-size;
        padding: 12px 0;
    }

    .head {
        margin-bottom: 12px;
    }

    .title {
        display: flex;
        align-items: center;
        margin: 12px 0;
    }

    .small-title {
        margin: 2px 0;
        padding: 2px 0;
    }
}

.admin-config-group[data-toggle=collapse] {
    position: relative;
    cursor: pointer;

    &:after {
        @include fontawesome-font("\f078", regular); // chevron-down
        display: block;
        position: absolute;
        font-size: 0.85rem;
        line-height: 1;
        color: $body-color;
        inset-inline-end: 0;
        top: 50%;
        margin-top: -7px;
        transition: transform 0.25s ease-in-out;
    }

    &.collapsed:after {
        transform: rotate(-90deg);
    }
}


//
// Themes
// --------------------------------------------------

#theme-list {
    .theme-thumbnail {
        height: 220px;
        background-size: cover;
        background-repeat: no-repeat;
        border-bottom: 1px solid rgba(#000, 0.1);
    }

    .theme-broken-badge {
        position: absolute;
        background-color: $danger;
        color: #fff;
        right: 0;
        bottom: 0;
        padding: 0.25rem 0.75rem;
        font-size: 1rem;
    }
}

.theme-editor {
    .themevar-chain-info {
        color: $gray-600;
        margin-left: 0.75rem;
        white-space: nowrap;
    }
}


//
// Datetimepicker
// --------------------------------------------------

.datetimepicker-group {
    .input-group-text {
        padding-left: 0 !important;
        padding-right: 0 !important;
        width: $input-height;

        > i {
            width: 100%;
        }
    }

    &.input-group-sm .input-group-text {
        width: $input-height-sm;
    }

    &.input-group-lg .input-group-text {
        width: $input-height-lg;
    }
}

// Modules & Providers
// --------------------------------------------------------------

.sortable-grip {
    left: 0;
    width: 9px;
    z-index: 1000;
}

.module-list {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(390px, max-content));
    gap: 20px;
    margin-bottom: 2rem;

    .module-group {
        display: contents;
    }

    .module-group-header {
        grid-column: 1 / -1;
        color: $text-muted;
        font-size: $h5-font-size;
        margin-top: 1.5rem;
        margin-bottom: 0;
    }
}

.module-item {
    > .card-body, 
    > .card-footer {
        display: flex;
        gap: 1rem;
    }

    &.inactive {
        background-color: $gray-100;

        .module-icon {
            opacity: 0.5;
        }
    }

    .btn.activate-provider {
        > svg {
            margin-inline-end: 0.2rem;
        }
        > span {
            padding: 0 !important;
        }
    }
}

.module-icon {
    display: flex;
    width: 64px;
    align-items: start;
    justify-content: center;
    flex: 0 0 auto;
    max-width: none;

    > .icon, > i {
        max-width: 48px;
    }
}

.module-signal {
    border-radius: 50%;
    width: 12px; 
    height: 12px
}

.module-commands {
    display: flex;
    gap: 2px;
    flex-grow: 1;
    align-items: center;
    justify-content: space-between;
}

.module-data {
    display: flex;
    flex-flow: column; 
    flex-basis: 0;
    flex-grow: 1;
    gap: 0.75rem;
    overflow: hidden;
}

.module-name {
    font-weight: $font-weight-medium;
    font-size: $font-size-lg;
}

.module-info {
    display: grid; 
    grid-template-columns: max-content 1fr; 
    gap: 1px 20px;
    
    > .attr-name {
        font-weight: $font-weight-medium;
    }

    > .attr-value {
        display: inline-block;
        color: $text-muted;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
    }
}

.module-description {
    font-size: $font-size-sm;
    color: $gray-600;
    width: 100%;
}

a.editable {
    font-weight: $font-weight-medium;
    text-decoration: none;
    border-bottom: 1px dashed $link-color;

    &.editable-empty {
        font-style: normal;
        font-weight: $font-weight-normal;
        color: $text-muted;
        border-bottom-color: $text-muted;
    }
}


//
// Module configuration
// --------------------------------------------------

.section-header .options .plugin-actions {
    display: inline-block;
}

.plugin-config-container .plugin-actions {
    display: none;
}

.plugin-configuration {
    display: flex;
    flex-wrap: nowrap;
    margin-top: 1rem;

    > div:first-child {
        flex-basis: 0;
        flex-grow: 1;
        max-width: 100%;
    }

    > div:last-child {
        flex: 0 0 auto;
        width: auto;
        max-width: 300px;
        padding-left: 2rem;
    }

    img {
        max-width: 100%;
        height: auto;
    }
}


// Special icons
// --------------------------------------------------------------

.icon-active-true {
    color: $green;
    text-shadow: 0 -1px 0 #fff;

    &::before {
        content: '\f00c';
    }
}

.icon-active-false {
    color: $gray-400;
    text-shadow: 0 -1px 0 #fff;

    &::before {
        content: '\f068';
    }
}


// Attributes
// --------------------------------------------------------------


#order-edit .checkout-attributes {
    .attr-caption {
        font-weight: $font-weight-medium;
        padding-inline-end: 10px;
        &:after {
            content: ': '
        }
    }
    .attr-value {
        text-align: start;
    }
}

/* Table formatted variant attributes */
.product-attribute-table {
    .column-name {
        min-width: 80px;
        padding: 2px 10px 2px 0;
        vertical-align: top;
        font-weight: $font-weight-medium;
    }

    .column-value {
        padding: 2px 0 2px 0;
        vertical-align: top;
    }
}


//
// Import column mapping
// --------------------------------------------------------------

@media (max-width: 1280px) {
    #ImportColumnMappings .right-label,
    .column-mapping .mapping-button-label,
    .mapping-list-item .right-label {
        display: none;
    }
}

.column-mapping .right-label,
.mapping-list-item .right-label {
    font-size: 0.9em;
    padding-top: 2px;
    align-self: flex-end;
}

.mapping-list-item {
    @include text-truncate();
    display: flex;
    flex-wrap: nowrap;
}

.mapping-edit .mapping-list-item,
.column-mapping-new .mapping-list-item {
    display: contents;
}

.column-mapping {
    .column-one,
    .column-two {
        width: 42%;
    }

    .select2-container .select2-choice span {
        margin-right: 12px;
        white-space: nowrap;
    }

    .mapping-edit {
        white-space: nowrap;

        .select-column,
        .select-property {
            width: 84%;
        }
    }

    .mapping-item {
        .item-inner {
            white-space: nowrap;
            cursor: pointer;
            padding: 7px 0;
            display: flex;
            flex-wrap: nowrap;
        }

        .select2-selection__clear {
            margin-inline-start: 3px;
        }
    }
}

//
// Pane resizer
// --------------------------------------------------------------

.resizer,
.is-resizing {
    cursor: col-resize;
}

.resizer {
    overflow: hidden;
    position: relative;
    width: 5px;
    margin: 0 -2px;
    user-select: none;
    z-index: 2;

    &:after {
        z-index: 3;
        content: '';
        position: absolute;
        width: 1px;
        left: 2px;
        height: 100%;
        background-color: rgba(#000, 0.1);
    }
}

//
// Menus
// --------------------------------------------------------------

.menu-item-list {
    .menu-item {
        position: relative;
        overflow: visible;
    }
}

//
// Rules
// --------------------------------------------------------------

.rule-row,
.ruleset {
    margin: 1rem;
}

.ruleset-root > .ruleset {
    margin: 0;
    margin-top: 1rem;
}

.ruleset {
    --r-border-color: var(--warning);
    border: 1px solid rgba(#000, 0.15);
    border-radius: 6px;
    border-left: 3px solid var(--r-border-color);
    background-color: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;

    &.hover {
        border-color: var(--r-border-color);
    }
}

.ruleset .ruleset {
    --r-border-color: var(--primary);
    background-color: rgba(#000, 0.04);
    box-shadow: 0 0 .75rem 0 rgba(#000, .05), 0 0.3125rem 1rem rgba(#000, 0);

    &.hover {
        box-shadow: 0 1rem 2.25rem rgba(#32325d, .03), 0 0.3125rem 1rem rgba(#000, .12);
    }
}

.ruleset .ruleset .ruleset {
    --r-border-color: var(--success);
    background-color: #fff;
}

.ruleset .ruleset .ruleset .ruleset {
    --r-border-color: var(--indigo);
    background-color: rgba(#000, 0.04);
}

.ruleset .ruleset .ruleset .ruleset .ruleset {
    --r-border-color: var(--info);
    background-color: #fff;
}

.ruleset .ruleset .ruleset .ruleset .ruleset {
    --r-border-color: var(--gray);
    background-color: rgba(#000, 0.04);
}

.ruleset-header {
    padding: 0.5rem 1rem;
    background-color: rgba(0,0,0, 0.03);
    border-radius: 6px 6px 0 0;
    border-bottom: 1px solid rgba(0,0,0, 0.15);
}

.ruleset-footer {
    margin: 1rem;
}

.rule-operator > .dropdown-menu {
    --dropdown-min-width: 100%
}


//
// Misc
// --------------------------------------------------------------

.search-expression-toggle {
    color: $text-muted;
    text-decoration: none;
    transition: color 0.12s ease;
    pointer-events: auto;

    &:hover {
        color: $body-color;
    }
}

.color-container {
    display: inline-block;
    background-color: transparent;
    padding-right: 0.5rem;
    line-height: 1;

    .color {
        width: $font-size-base;
        height: $font-size-base;
        vertical-align: bottom;
        display: inline-block;
        border-radius: var(--border-radius-sm);
        border: 1px solid rgba($black, 0.06);
    }
}

.cke_chrome.cke_focus {
    border-color: $input-focus-border-color;
    box-shadow: none;
}

// AI dropdown
// --------------------------------------------------------------

.ai-dialog-opener {
    pointer-events: initial !important;
    height: auto !important;
}

.ai-dialog-opener-root .fu-remove {
    margin-inline-end: 2.25em;
}